<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="tab" class="secondNav">
      <el-tab-pane :label="$t('configLazyLoad.robotSeven.baseInfo')" name="robotInfo">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.robotSeven.qaManage')" name="questionManage">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.robotSeven.intelligentLearning')" name="intelligentStudy">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.robotSeven.unknowLearn')" name="unknownStudy">
      </el-tab-pane>
      <el-tab-pane :label="$t('configLazyLoad.robotSeven.userDictionary')" name="userDictionary" v-if="$store.state.session.user.identity === 'admin'">
      </el-tab-pane>
    </el-tabs>
    <keep-alive>
      <component :is="activeName" class="content robot"></component>
    </keep-alive>
  </div>
</template>
<script>
  import robotInfo from './RobotInfo.vue'
  import questionManage from './QuestionManage.vue'
  import intelligentStudy from './IntelligentStudy.vue'
  import unknownStudy from './UnknownStudy.vue'
  import userDictionary from './UserDictionary.vue'
  import {innerHtmlChannelColor} from '@/utils/m7Utils'
  export default {
    name: 'robotConfig',
    data () {
      return {
        activeName: 'robotInfo',
        currentRoute: ''
      }
    },
    components: {
      robotInfo,
      questionManage,
      intelligentStudy,
      unknownStudy,
      userDictionary
    },
    methods: {
      tab (tab, event) {
      }
    },
//    beforeRouteLeave (to, from, next) {
//      this.currentRoute = from.fullPath
//      next()
//    },
//    beforeRouteEnter (to, from, next) {
//      next(vm => {
//        if (vm.currentRoute) {
//          vm.$router.push({path: vm.currentRoute})
//        }
//      })
//    },
    beforeMount () {
      let self = this
      this.$store.dispatch('getCache', {type: 'channelGlobalSet'}).then((channelGlobalSet) => {
        innerHtmlChannelColor(self)
      })
    }
  }
</script>
<style lang="stylus">
  .robot
    .second-dialog
      overflow hidden
    .el-dialog__body
      height 350px
      overflow-y auto
    .unauto
      .el-dialog__body
        overflow-y hidden
    .message-box
      .el-dialog__body
        height auto
</style>
<style lang="stylus" scoped>
  @import "../../../../assets/common.styl"
  .content
    height calc(100vh - 144px)
    overflow-y auto
</style>
